package com.wing.bill.controller.admin;

import com.wing.bill.service.CheckReportService;
import com.wing.common.utils.JsonResult;
import com.wing.common.utils.PageResult;
import com.wing.web.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Validated
@Api(value = "Admin-刀具柜盘验报表", tags = "#/bill/checkReport")
@RestController("checkReportController")
@RequestMapping("bill/admin/checkReport")
@RequiredArgsConstructor
public class CheckReportController {

    private final CheckReportService checkReportService;

    @ApiOperation(value = "顶部折线图", notes = "搜索")
    @GetMapping("/list")
    public JsonResult list(
            @RequestParam("param")String param  //qua 数量 money金额
    ){
        return checkReportService.list(param, JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "顶部格子数据", notes = "搜索")
    @GetMapping("/topCell")
    public JsonResult topCell(
            @RequestParam("type")String type//012 当日当周当月
            ,@RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("click")String click//顶部数据点击
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
    ){
        return checkReportService.topCell(type,startTime,endTime,Integer.valueOf(click),mainCabCode,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "中部第一二三个图", notes = "搜索")
    @GetMapping("/midFirstChart")
    public JsonResult midFirstChart(
            @RequestParam("type")String type//012 当日当周当月
            ,@RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("param")String param //柱状图饼状图的下拉选 不同的选项 qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,@RequestParam("other")String other//柱状图饼状图的下拉选 不同的选项 规格 oldSpec 编号 skuCode 品牌 brand  类型 type  分类 category 部门  dep 责任人 person 设备 device
    ){
        return checkReportService.midFirstChart(type,startTime,endTime,mainCabCode,JwtUtils.getEnterpriseCode(),param,other);
    }

    @ApiOperation(value = "中部第4-15个图", notes = "搜索")
    @GetMapping("/midSecondChart")
    public JsonResult midSecondChart(
            @RequestParam("type")String type//012 当日当周当月
            ,@RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("param")String param //柱状图饼状图的下拉选 不同的选项 qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,@RequestParam("other")String other//柱状图饼状图的下拉选 不同的选项 规格 oldSpec 编号 skuCode 品牌 brand  类型 type  分类 category 部门  dep 责任人 person 设备 device
            ,@RequestParam("option")String option//报修rep报废scr报失loss
    ){
        return checkReportService.midSecondChart(type,startTime,endTime,mainCabCode,JwtUtils.getEnterpriseCode(),param,other,option);
    }



    @ApiOperation(value = "底部折线图", notes = "搜索")
    @GetMapping("/midThirdChart")
    public JsonResult midThirdChart(
            @RequestParam("type")String type//012 当日当周当月
            ,@RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,@RequestParam("param")String param //柱状图饼状图的下拉选 不同的选项 qua 数量 money 金额
    ){
        return checkReportService.midThirdChart(type,startTime,endTime,mainCabCode,param,JwtUtils.getEnterpriseCode());
    }



}
